from flask import Blueprint, request
import warnings

warnings.filterwarnings("ignore")
import json
import sys
import os

from flask import Blueprint, request


from llm_func import *
# 创建蓝图
XpScore = Blueprint('XpScore', __name__, url_prefix='/')




@XpScore.route('/model/llm', methods=['GET', 'POST'])
def LLM_green_model():
    receive = request.get_data()
    receive = receive.decode('utf-8')
    js = json.loads(receive)


    if str(js)[0] == '{':
        projectType = js['projectType']

    if str(js)[0] == '[':
        projectType = js[0]['projectType']


    # dft = GetResult(js, projectType)
    dft = GetLLMresult(js)
    datas = dft.to_json(orient='records', force_ascii=False)

    return datas
